package me.jessyan.armscomponent.app.mvp.model.mine;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import javax.inject.Inject;

import io.reactivex.Observable;
import me.jessyan.armscomponent.commonsdk.core.ResultCodeHub;
import me.jessyan.armscomponent.commonsdk.http.BaseResponse;
import me.jessyan.armscomponent.app.R;
import me.jessyan.armscomponent.app.mvp.contract.mine.MineAchievementsContract;
import me.jessyan.armscomponent.app.mvp.model.entity.AchievementsItem;


/**
 * <p>
 * Author: Taozebi
 * Date: 08/08/2021 17:59
 * Description: describe of this class
 */
@ActivityScope
public class MineAchievementsModel extends BaseModel implements MineAchievementsContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public MineAchievementsModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public Observable<BaseResponse<List<AchievementsItem>>> getAchievementsList() {
        return getList();
    }

    private Observable<BaseResponse<List<AchievementsItem>>> getList(){
        List<AchievementsItem> list = new ArrayList<>();
        AchievementsItem bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_01);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_02);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_03);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_04);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_05);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_06);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_07);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_08);
        list.add(bean);

        bean = new AchievementsItem();
        bean.setAchievementsName("成就勋章");
        bean.setIcRes(R.drawable.mine_ic_cup_09);
        list.add(bean);

        BaseResponse<List<AchievementsItem>> response = new BaseResponse<>();
        response.setResult(list);
        response.setPage(1);
        response.setPageCount(10);
        response.setCode(ResultCodeHub.CODE_0);
        return  Observable.just(response).delay(2, TimeUnit.SECONDS);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }
}